package com.yunji.framework_template.web.service;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import com.netflix.hystrix.contrib.servopublisher.HystrixServoMetricsPublisher;
import com.netflix.hystrix.strategy.HystrixPlugins;
import com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifierDefault;

import lombok.extern.slf4j.Slf4j;
 
/**
 * 
 * @author fenglibin
 *
 */
@Slf4j
public class HystrixMetricsInitializingBean{

	public void afterPropertiesSet() throws Exception {
		// TODO Auto-generated method stub
		log.info("HystrixMetrics starting...");
        HystrixPlugins.getInstance().registerEventNotifier(HystrixEventNotifierDefault.getInstance());
        HystrixPlugins.getInstance().registerMetricsPublisher(HystrixServoMetricsPublisher.getInstance());
	}
}
